<?php
	Header("Pragma: No-cache");
        set_include_path('./../../nearestCaches/library' . PATH_SEPARATOR . get_include_path());
	include "functions.php";
	$versionInt = getClientIntVersion();
   	$lang = getLang();

		//after authorization we send form which gets coordinates
		echo '<?xml version="1.0" encoding="utf-8" ?>
			<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
				<html xmlns="http://www.w3.org/1999/xhtml" xmlns:locify="http://client.locify.com/locify_ns/1.0" xml:lang="en" lang="en">
				<head>
					<title>'.$lang['show_nearest'].'</title>
				</head>
				<body class="form">
					<form action="'.SERVICE_URL.'nearest.php" method="post">';
		if($versionInt && $versionInt < 85)	{
			echo '
				<fieldset>
					<label>'.$lang['latitude'].': <input type="text" name="latitude" value="$lat" /></label>
					<label>'.$lang['longitude'].': <input type="text" name="longitude" value="$lon" /></label>
					<label>'.$lang['filter_out_finds'].':
						<select name="finds" locify:selected="1">
							<option value="1">'.$lang['yes'].'</option>
							<option value="0">'.$lang['no'].'</option>
						</select>
					</label>
					<input type="submit" value="'.$lang['show_nearest'].'" />
				</fieldset>';
		} elseif($versionInt && $versionInt < 90) {
			echo '
				<script src="http://code.google.com/apis/gears/gears_init.js" type="text/javascript"></script>
				<script src="http://www.locify.com/scripts/mootools/mootools.nosel.js" type="text/javascript"></script>
				<script src="http://www.locify.com/scripts/mootools/mootools.patch.js" type="text/javascript"></script>
				<script src="http://www.locify.com/scripts/services/geolocation.js" type="text/javascript"></script>
				<locify:variables>
					<locify:element name="latitude" value="$lat" />
					<locify:element name="longitude" value="$lon" />
				</locify:variables>
				<fieldset>
					<label>'.$lang['latitude'].': <input type="text" name="latitude" value="" /></label>
					<label>'.$lang['longitude'].': <input type="text" name="longitude" value="" /></label>
					<label>'.$lang['filter_out_finds'].':
						<select name="finds" locify:selected="1">
							<option value="1">'.$lang['yes'].'</option>
							<option value="0">'.$lang['no'].'</option>
						</select>
					</label>
					<input type="submit" value="'.$lang['show_nearest'].'" name="submit" />
				</fieldset>';
		} else {
			echo '
			<locify:variables>
				<locify:element name="latitude" value="$lat" />
				<locify:element name="longitude" value="$lon" />
			</locify:variables>
			<fieldset>
				<locify:where />
				<input type="hidden" name="latitude" value="" />
				<input type="hidden" name="longitude" value="" />
				<br />
				<input type="submit" value="'.$lang['show_nearest'].'" name="submit" />
				<label>'.$lang['filter_out_finds'].':
					<select name="finds">
						<option value="1">'.$lang['yes'].'</option>
						<option value="0">'.$lang['no'].'</option>
					</select>
				</label>
			</fieldset>';
		}
		echo '</form>
				</body>
			</html>';
	
?>
